package cn.seecoder.ai.controller;

import cn.seecoder.ai.model.vo.ResultVO;
import cn.seecoder.ai.model.vo.UserVO;
import cn.seecoder.ai.service.UserService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;


/**
 * @author fanyanpeng
 * @date 2023/4/11 0:48
 */
@Slf4j
@RestController
@RequestMapping("${apiPrefix}/user")
public class UserController {

    @Autowired
    UserService userService;

    @PostMapping("/register")
    public ResultVO<UserVO> register( @RequestBody UserVO userVO){
        return ResultVO.buildSuccess(userService.register(userVO));
    }


    @PostMapping("/login")
    public ResultVO<UserVO> login(@RequestBody UserVO userVO){
        return ResultVO.buildSuccess(userService.login(userVO));
    }





}
